<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="Tween,mx.effects.Tween,duration,listener,easingFunction,endTween,pause,resume,reverse,seek,setTweenHandlers,stop" name="keywords">
<title>mx.effects.Tween</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'Tween - Zentrum virtUOS: virtPresenter';
				var baseRef = '../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">virtPresenter AsDoc</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../index.html?mx/effects/Tween.html&amp;mx/effects/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Tween</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Tween"); titleBar_setSubNav(false,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">mx.effects</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Tween</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">Tween <img class="inheritArrow" alt="Inheritance" title="Inheritance" src="../../images/inherit-arrow.gif"> flash.events.EventDispatcher</td>
</tr>
</table>
<p></p>
  The Tween class defines a tween, a property animation performed
  on a target object over a period of time.
  That animation can be a change in position, such as performed by
  the Move effect; a change in size, as performed by the Resize or
  Zoom effects; a change in visibility, as performed by the Fade or
  Dissolve effects; or other types of animations.
   <p>When defining tween effects, you typically create an instance
  of the Tween class within your override of the 
  <code>EffectInstance.play()</code> method.
  A Tween instance accepts the <code>startValue</code>,
  <code>endValue</code>, and <code>duration</code> properties, 
  and an optional easing function to define the animation.</p> 
   <p>The Tween object invokes the
  <code>mx.effects.effectClasses.TweenEffectInstance.onTweenUpdate()</code> 
  callback function on a regular interval on the effect instance
  for the duration of the effect, passing to the
  <code>onTweenUpdate()</code> method an interpolated value 
  between the <code>startValue</code> and <code>endValue</code>.
  Typically, the callback function updates some property of the target object, 
  causing that object to animate over the duration of the effect.</p>
   <p>When the effect ends, the Tween objects invokes the 
  <code>mx.effects.effectClasses.TweenEffectInstance.onTweenEnd()</code>
  callback function, if you defined one. </p>
   <p></p>
<p>
<span class="classHeaderTableLabel">See also</span>
</p>
<div class="seeAlso">
<a href="../effects/TweenEffect.html" target="">mx.effects.TweenEffect</a>
<br>
<a href="effectClasses/TweenEffectInstance.html" target="">mx.effects.effectClasses.TweenEffectInstance</a>
</div>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#duration">duration</a> : Number = 3000<div class="summaryTableDescription">
      Duration of the animation, in milliseconds.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#easingFunction">easingFunction</a> : Function<div class="summaryTableDescription">[write-only]
      Sets the easing function for the animation.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#listener">listener</a> : Object<div class="summaryTableDescription">
      Object that is notified at each interval of the animation.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Tween()">Tween</a>(listener:Object, startValue:Object, endValue:Object, duration:Number = -1, minFps:Number = -1, updateFunction:Function = null, endFunction:Function = null)</div>
<div class="summaryTableDescription">
      Constructor.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#endTween()">endTween</a>():void</div>
<div class="summaryTableDescription">
      Interrupt the tween, jump immediately to the end of the tween, 
      and invoke the <code>onTweenEnd()</code> callback function.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#pause()">pause</a>():void</div>
<div class="summaryTableDescription">
      Pauses the effect until you call the <code>resume()</code> method.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#resume()">resume</a>():void</div>
<div class="summaryTableDescription">
      Resumes the effect after it has been paused 
      by a call to the <code>pause()</code> method.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#reverse()">reverse</a>():void</div>
<div class="summaryTableDescription">
      Plays the effect in reverse,
      starting from the current position of the effect.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#seek()">seek</a>(playheadTime:Number):void</div>
<div class="summaryTableDescription">
      Advances the tween effect to the specified position.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#setTweenHandlers()">setTweenHandlers</a>(updateFunction:Function, endFunction:Function):void</div>
<div class="summaryTableDescription">
      By default, the Tween class invokes the 
      <code>mx.effects.effectClasses.TweenEffectInstance.onTweenUpdate()</code> 
      callback function on a regular interval on the effect instance
      for the duration of the effect, and the optional 
      <code>mx.effects.effectClasses.TweenEffectInstance.onTweenEnd()</code>
      callback function at the end of the effect duration.</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#stop()">stop</a>():void</div>
<div class="summaryTableDescription">
      Stops the tween, ending it without dispatching an event or calling
      endFunction or onTweenEnd().</div>
</td><td class="summaryTableOwnerCol">Tween</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="duration"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">duration</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>public var duration:Number = 3000</code><p>
      Duration of the animation, in milliseconds. 
     </p></div>
<a name="easingFunction"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">easingFunction</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>easingFunction:Function</code>&nbsp;&nbsp;[write-only]<p>
      Sets the easing function for the animation.
      The easing function is used to interpolate between
      the <code>startValue</code> value and the <code>endValue</code>.
      A trivial easing function does linear interpolation,
      but more sophisticated easing functions create the illusion of
      acceleration and deceleration, which makes the animation seem
      more natural.
           </p><p>If no easing function is specified, an easing function based
      on the <code>Math.sin()</code> method is used.</p>
           <p>The easing function follows the function signature
      popularized by Robert Penner.
      The function accepts four arguments.
      The first argument is the "current time",
      where the animation start time is 0.
      The second argument is a the initial value
      at the beginning of the animation (a Number).
      The third argument is the ending value
      minus the initial value.
      The fourth argument is the duration of the animation.
      The return value is the interpolated value for the current time
      (usually a value between the initial value and the ending value).</p>
           <p>Flex includes a set of easing functions
      in the mx.effects.easing package.</p>
           <span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function set easingFunction(value:Function):void</code>
<br>
</div>
<a name="listener"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">listener</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var listener:Object</code><p>
      Object that is notified at each interval of the animation. 
     </p></div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="Tween()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Tween</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function Tween(listener:Object, startValue:Object, endValue:Object, duration:Number = -1, minFps:Number = -1, updateFunction:Function = null, endFunction:Function = null)</code><p>
      Constructor.
           </p><p>When the constructor is called, the animation automatically
      starts playing.</p>
           <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">listener</span>:Object</code> &mdash; Object that is notified at each interval
      of the animation. You typically pass the <code>this</code> 
      keyword as the value.
      The <code>listener</code> must define the 
      <code>onTweenUpdate()</code> method and optionally the  
      <code>onTweenEnd()</code> method.
      The former method is invoked for each interval of the animation,
      and the latter is invoked just after the animation finishes.
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">startValue</span>:Object</code> &mdash; Initial value(s) of the animation.
      Either a number or an array of numbers.
      If a number is passed, the Tween interpolates
      between this number and the number passed
      in the <code>endValue</code> parameter.
      If an array of numbers is passed, 
      each number in the array is interpolated.
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">endValue</span>:Object</code> &mdash; Final value(s) of the animation.
      The type of this argument must match the <code>startValue</code>
      parameter.
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">duration</span>:Number</code> (default = <code>-1</code>)<code></code> &mdash; Duration of the animation, expressed in milliseconds.
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">minFps</span>:Number</code> (default = <code>-1</code>)<code></code> &mdash; Minimum number of times that the
      <code>onTweenUpdate()</code> method should be called every second.
      The tween code tries to call the <code>onTweenUpdate()</code>
      method as frequently as possible (up to 100 times per second).
      However, if the frequency falls below <code>minFps</code>, 
      the duration of the animation automatically increases.
      As a result, an animation that temporarily freezes
      (because it is not getting any CPU cycles) begins again
      where it left off, instead of suddenly jumping ahead. 
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">updateFunction</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; Specifies an alternative update callback 
      function to be used instead of <code>listener.OnTweenUpdate()</code>
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">endFunction</span>:Function</code> (default = <code>null</code>)<code></code> &mdash; Specifies an alternative end callback function
      to be used instead of <code>listener.OnTweenEnd()</code>
     </td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="endTween()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">endTween</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function endTween():void</code><p>
      Interrupt the tween, jump immediately to the end of the tween, 
      and invoke the <code>onTweenEnd()</code> callback function.
     </p></div>
<a name="pause()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">pause</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function pause():void</code><p>
      Pauses the effect until you call the <code>resume()</code> method.
     </p></div>
<a name="resume()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">resume</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function resume():void</code><p>
      Resumes the effect after it has been paused 
      by a call to the <code>pause()</code> method. 
     </p></div>
<a name="reverse()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">reverse</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function reverse():void</code><p>
      Plays the effect in reverse,
      starting from the current position of the effect.
     </p></div>
<a name="seek()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">seek</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function seek(playheadTime:Number):void</code><p>
      Advances the tween effect to the specified position. 
           </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">playheadTime</span>:Number</code> &mdash; The position, in milliseconds, between 0
      and the value of the <code>duration</code> property.
     </td>
</tr>
</table>
</div>
<a name="setTweenHandlers()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">setTweenHandlers</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function setTweenHandlers(updateFunction:Function, endFunction:Function):void</code><p>
      By default, the Tween class invokes the 
      <code>mx.effects.effectClasses.TweenEffectInstance.onTweenUpdate()</code> 
      callback function on a regular interval on the effect instance
      for the duration of the effect, and the optional 
      <code>mx.effects.effectClasses.TweenEffectInstance.onTweenEnd()</code>
      callback function at the end of the effect duration. 
           </p><p>This method lets you specify different methods 
      as the update and the end callback functions.</p>
           <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">updateFunction</span>:Function</code> &mdash; Specifies the update callback function.
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">endFunction</span>:Function</code> &mdash; Specifies the end callback function.
     </td>
</tr>
</table>
</div>
<a name="stop()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">stop</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function stop():void</code><p>
      Stops the tween, ending it without dispatching an event or calling
      endFunction or onTweenEnd(). 
     </p></div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
